<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>故障诊断 - 故障诊断系统</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
</head>
<body>
    <!-- 导航栏 -->
    <nav class="navbar navbar-expand-lg navbar-dark bg-primary">
        <div class="container">
            <a class="navbar-brand" href="{{ url_for('main.index') }}">故障诊断系统</a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav">
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for('main.index') }}">主页</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for('training.index') }}">模型训练</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link active" href="{{ url_for('inference.index') }}">故障诊断</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for('data.index') }}">数据管理</a>
                    </li>
                </ul>
            </div>
        </div>
    </nav>

    <!-- 主要内容 -->
    <div class="container mt-4">
        <div class="row">
            <!-- 输入数据卡片 -->
            <div class="col-md-6 mb-4">
                <div class="card">
                    <div class="card-header">
                        <h5 class="card-title mb-0">输入数据</h5>
                    </div>
                    <div class="card-body">
                        <form id="inference-form" class="inference-form">
                            <div class="form-group">
                                <label for="input-data">输入数据 (JSON格式):</label>
                                <textarea id="input-data" name="input-data" rows="4" class="form-control" required
                                    placeholder='请输入JSON格式的数据，例如: [1.0, 2.0, 3.0, 4.0]'></textarea>
                                <div class="form-text">输入需要诊断的数据，格式为JSON数组</div>
                            </div>
                            <button type="submit" class="btn btn-primary mt-3">开始诊断</button>
                        </form>
                    </div>
                </div>

                <!-- 数据格式说明 -->
                <div class="card mt-3">
                    <div class="card-header">
                        <h5 class="card-title mb-0">数据格式说明</h5>
                    </div>
                    <div class="card-body">
                        <ul>
                            <li>输入数据必须是JSON格式的数组</li>
                            <li>数组长度必须与训练数据特征数量相同</li>
                            <li>所有值必须是数值类型</li>
                            <li>示例: [1.0, 2.0, 3.0, 4.0]</li>
                        </ul>
                    </div>
                </div>
            </div>

            <!-- 诊断结果卡片 -->
            <div class="col-md-6 mb-4">
                <div class="card">
                    <div class="card-header">
                        <h5 class="card-title mb-0">诊断结果</h5>
                    </div>
                    <div class="card-body">
                        <div id="result" class="result-container">
                            <!-- 结果将在这里显示 -->
                        </div>
                    </div>
                </div>

                <!-- 置信度分布图 -->
                <div class="card mt-3">
                    <div class="card-header">
                        <h5 class="card-title mb-0">置信度分布</h5>
                    </div>
                    <div class="card-body">
                        <div id="confidence-plot"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 页脚 -->
    <footer class="footer mt-5 py-3 bg-light">
        <div class="container text-center">
            <span class="text-muted">故障诊断系统 &copy; 2024</span>
        </div>
    </footer>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
    <script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
    <script src="{{ url_for('static', filename='js/inference.js') }}"></script>
</body>
</html> 